package com.client.mapper;

import com.client.entity.auth.Command;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CommandDao {
    //查询所有
    @Select("select * from command ")
    List<Command> queryAll();

    //按编号查询
    @Select("select * from command where id = #{ id }")
    Command queryById(@Param("id") long id);

    //按URL查询
    @Select("select * from command where URL = #{ URL }")
    Command queryByURL(@Param("URL") String URL);

    //按编号修改
    @Update("update command set URL= #{URL},description= #{description},createtime= #{CURRENT_TIMESTAMP} where id=#{id} ")
    void updatebyId(@Param("id") long id,@Param("URL") String URL,@Param("description") String description);

    //增加
    @Insert("insert into command values( #{id},#{URL}, #{description},CURRENT_TIMESTAMP )")
    void add(@Param("id") long id,@Param("URL") String URL,@Param("description") String description);

    //按编号删除
    @Delete("delete from command where id = #{id}")
    void deleteByName(@Param("id") long id);
    //删除所有
    @Delete("delete from command")
    void deleteAll();
}
